export default function omitEmptyField(obj) {
	return JSON.parse(JSON.stringify(obj), (key, value) => {
		if (typeof value !== 'object') return value;

		if (Array.isArray(value) && value.length === 0) return undefined;

		return Object.keys(value).length === 0 ? undefined : value;
	});
}
